package com.mfs.proxy.client.transfer.http.response;

import com.mfs.common.constant.Constant;

import java.io.UnsupportedEncodingException;

/**
 * Http响应行
 *
 * @author mfs
 * @date 2023/7/18 23:02
 **/
public class HttpResponseLine {
    private String version;
    private Integer status;
    private String describe;

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe;
    }

    public byte[] getBytes() {
        try {
            return (version + Constant.BLANK_STRING + status.toString() + Constant.BLANK_STRING + describe + "\r\n").getBytes("ascii");
        } catch (UnsupportedEncodingException e) {
        }
        return null;
    }

    @Override
    public String toString() {
        return version + Constant.BLANK_STRING + status + Constant.BLANK_STRING + Constant.BLANK_STRING + describe;
    }
}
